#include "nim_s3501.h"

void nim_comm_delay(UINT32 us)
{
	UINT32 i, j, k;
	i = us / 0xFFFF;
	j = us % 0xFFFF;
	for (k = 0; k < i; k++)
		osal_delay(0xffff);
	osal_delay(j);
	return;
}

void nim_comm_sleep(UINT32 ms)
{
	osal_task_sleep(ms);
}

INT32 nim_s3501_autoscan_signal_input(struct nim_device *dev, UINT8 s_Case)
{
	struct dmx_device *l_nim_dmx_dev;
	struct nim_s3501_private *priv = (struct nim_s3501_private *) dev->priv;
	l_nim_dmx_dev = (struct dmx_device *) dev_get_by_name("DMX_S3601_0");
	switch (s_Case)
	{
	case NIM_SIGNAL_INPUT_OPEN:
		dmx_io_control(l_nim_dmx_dev, IO_SET_BYPASS_MODE, (UINT32) (priv->ul_status.ADCdata));//Set bypass mode
		break;
	case NIM_SIGNAL_INPUT_CLOSE:
		dmx_io_control(l_nim_dmx_dev, IO_CLS_BYPASS_MODE, (UINT32) NULL);//Clear bypass mode.
		break;
	}

	return SUCCESS;
}


/***************************************************************
** SFU Test Function
***************************************************************/
static UINT32 g_ts_output_mode = 0;
UINT32 nim_s3501_set_ts_output_mode(struct nim_device *dev, UINT32 ts_output_mode)
{
	g_ts_output_mode = ts_output_mode;
}

